"""print() 将文件写到另外的文件里面"""
man = []
other = []

try:
    data = open("E:/ter.txt")
    for each_line in data:
        try:
            (role,line_spoken) = each_line.split(":", 1)
            line_spoken = line_spoken.strip()
            if role == "Man":
                man.append(line_spoken)
            elif role == "Other":
                other.append(line_spoken)
        except ValueError:
            pass
except IOError:
    print("File not find")
finally:
    data.close()

try:
    man_file = open("E:/man.txt", "w")
    other_file = open("E:/other.txt", "w")

    print(man, file=man_file)
    print(other, file=other_file)

except IOError:
    pass
finally:
    man_file.close()
    other_file.close()
